<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>User's Settings</title>
    </h:head>
    <h:body>
        
        Logged user: #{userBean.name}<br/>
        <p:link outcome="home" value="home"/><br />
    
        <h:form>
            <p:commandLink action="#{loginBean.logout()}" value="logout"/>
        </h:form>
        
        <br /><br /> 
        
        <h:form>
            <p:panel header="User's Settings" >
                <h:panelGrid id="setting" columns="2">
                    <h:outputLabel for="visibility" value="Set calendar visibility as public" />
                    <h:selectBooleanCheckbox id="visibility" value="#{settingsBean.user.calendarVisibility}" />
                    <p:commandButton id="save" value="Save" action="#{settingsBean.save()}" update="setting"/>
                    <h:outputLabel for="save" value="Changes saved" rendered="#{settingsBean.saved == true}"/>
                </h:panelGrid>   
            </p:panel>
            <br /><br />
            <p:commandButton id="unregister" value="Unregister" action="#{registrationBean.unregister()}" />
        </h:form>
        
        
    </h:body>
</html>